﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WCFServiceWebRole1_Tests
{
    class MainMethod
    {
        UnitTest1 unitobj = new UnitTest1();
 //ServiceHost serviceHost = null;

 //   try
 //   {
 //       var baseAddress = new Uri("http://localhost:8000/TestService");
 //       serviceHost = new ServiceHost(typeof (ServiceClass), baseAddress);
 //       Binding binding = new WSHttpBinding();
 //       var address = new EndpointAddress("http://localhost:8000/TestService/MyService");
 //       var endpoint = serviceHost
 //           .AddServiceEndpoint(typeof (IServiceContract), binding, address.Uri);

 //       var smb = new ServiceMetadataBehavior {HttpGetEnabled = true};
 //       serviceHost.Description.Behaviors.Add(smb);

 //       using (var client = new ProxyClient(endpoint.Name, endpoint.Address))
 //       {
 //           endpoint.Name = client.Endpoint.Name;

 //           serviceHost.Open();

 //           // ... magic happens 
 //       }

 //       serviceHost.Close();
 //   }
 //   catch (Exception ex)
 //   {
 //       // ... tests
 //   }
 //   finally
 //   {
 //       if (serviceHost != null)
 //       {
 //           ((IDisposable) serviceHost).Dispose();
 //       }
 //   }      


//            ServiceClient client = new ServiceClient();
//    var allCategories = client.GetCategories();
//    MessageBox.Show(allCategories.Count().ToString());

//• Sample Code to access REST service.
//Collapse | Copy Code

//    WebRequest request = WebRequest.Create("http://localhost:9002/SampleServices/Service/REST/Category/1");
//    WebResponse ws = request.GetResponse();
//    Encoding enc = System.Text.Encoding.GetEncoding(1252);
//    StreamReader responseStream = new StreamReader(ws.GetResponseStream());
//    string response = responseStream.ReadToEnd();
//    responseStream.Close();
//    MessageBox.Show(response);

    }
}
